package com.my.controller;


import com.my.service.StockService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;

@RestController
@CrossOrigin("*")
@RequestMapping("/stock")
public class StockController {

    StockService stockService;

    @Autowired
    public void setStockService(StockService stockService) {
        this.stockService = stockService;
    }

    @RequestMapping("/in")
    public String in(Integer goods_id, Integer orders_id, Integer type, Integer num) {
        return this.stockService.in(goods_id, orders_id, type, num);
    }

    @RequestMapping("/showAll")
    public String showAll(String context,
                          Integer currentPage,
                          Integer pageSize,
                          String sort,
                          Boolean asc,
                          HttpServletRequest req) {
        return this.stockService.showAll(context, currentPage, pageSize, sort, asc, req);
    }
}
